import { withCors } from '../../../lib/cors';
const { success, error, handleResponse } = require('../../../lib/response');

async function handler(req, res) {
  const highGoodsAPIs = {
    title: "高价值品统计API接口",
    description: "提供高价值品统计数据的全面分析接口",
    version: "1.0.0",
    tableInfo: {
      tableName: "wd_zcgk_gjzzcdwfb",
      description: "高价值品统计表",
      fields: {
        ID: "业务主ID",
        TJSJ: "统计时间",
        DWMC: "单位名称",
        GJZSL: "高价值品数量",
        GJZJE: "高价值品总金额"
      }
    },
    endpoints: [
      {
        path: "/api/high-goods/basic-stats",
        method: "GET",
        name: "基础统计",
        description: "获取高价值品总数量、总金额、单位数量等基础统计数据"
      },
      {
        path: "/api/high-goods/unit-analysis", 
        method: "GET",
        name: "单位分析",
        description: "按单位统计高价值品数量和金额的分布与排名"
      },
      {
        path: "/api/high-goods/quantity-analysis",
        method: "GET", 
        name: "数量分析",
        description: "高价值品数量分布、阈值分析和占比统计"
      },
      {
        path: "/api/high-goods/financial-analysis",
        method: "GET",
        name: "金额分析", 
        description: "金额分布、单品价值、性价比分析等财务数据统计"
      },
      {
        path: "/api/high-goods/time-analysis",
        method: "GET",
        name: "时间分析",
        description: "按统计时间的趋势分析和时间序列统计"
      },
      {
        path: "/api/high-goods/efficiency-analysis",
        method: "GET",
        name: "效率评估",
        description: "配置效率、风险管理和决策支持分析"
      }
    ]
  };

  return handleResponse(res, success(highGoodsAPIs, "高价值品API信息获取成功"));
}

export default withCors(handler, ['GET']);